package leetcode;

import java.util.*;

/***
 * 题目：3483. 不同三位偶数的数目
 * 链接：https://leetcode.cn/problems/unique-3-digit-even-numbers/
 */
public class TotalNumbers {
    public static void main(String[] args) {
        System.out.println(new TotalNumbers().totalNumbers(new int[]{0,1,5}));
    }
    public int totalNumbers(int[] nums) {
        if (nums == null || nums.length < 3) {
            return 0;
        }
        HashMap<Integer, Integer> map = new HashMap<>();
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] == 0) continue;
            for(int j = 0; j < nums.length; j++) {
                if(i==j) continue;
                for(int k = 0;k < nums.length;k++) {
                    if(i==k || j==k) continue;
                    else if (nums[k] % 2 == 0) {
                        int num = nums[i] * 100 + nums[j] * 10 + nums[k];
                        if (map.getOrDefault(num, 0) == 0) {
                            map.put(num, 1);
                        }
                    }
                }
            }
        }
        return map.size();
    }
}
